package cc.rengu.igas.share.facade.bean.cups;

import cc.rengu.oltp.service.common.enums.OltpRpcdEnum;
import cc.rengu.oltp.service.model.BizException;

import java.util.Arrays;

/**
 * 域104 MU Tag02 资金用途
 *
 * @author yangfan
 * @version 1.0
 * @date 2021/5/7
 */
@SuppressWarnings("AlibabaEnumConstantsMustHaveComment")
public enum F104_MU_02_FundUseEnum {
    _001("001", "工资"),
    _002("002", "津贴"),
    _003("003", "奖金"),
    _004("004", "劳务报酬"),
    _005("005", "劳保与福利"),
    _006("006", "收购价款"),
    _007("007", "差旅费"),
    _008("008", "小额零星支出"),
    _009("009", "备用金"),
    _010("010", "投资本金及收益"),
    _011("011", "权益转让收益"),
    _012("012", "个人贷款转存"),
    _013("013", "证券交易结算资金"),
    _014("014", "期货交易保证金"),
    _015("015", "继承赠与款项"),
    _016("016", "保险理赔、保费退换款项"),
    _017("017", "纳税退还款项"),
    _018("018", "农副矿产品销售收入"),
    _019("019", "划款"),
    _020("020", "货款"),
    _021("021", "工程款"),
    _022("022", "预付款"),
    _023("023", "销售款"),
    _024("024", "材料费"),
    _000("000", "其他"),
    ;

    private String code;
    private String desc;

    F104_MU_02_FundUseEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return code + "-" + desc;
    }

    public static F104_MU_02_FundUseEnum find(String code) {
        F104_MU_02_FundUseEnum result = Arrays.stream(F104_MU_02_FundUseEnum.values())
                .filter(e -> e.getCode().equals(code)).findFirst().orElse(null);

        if (result == null) {
            throw new BizException(OltpRpcdEnum.PARAM_IS_EMPTY_OR_NULL.getRespCode(), "找不到对应的枚举信息" + code);
        }
        return result;
    }
}
